Repository navigation
Conversation
The AccountProof and StorageProof schemas of execution-apis set additionalProperties to false, so an answer or a slot holds no other property. The reader of an answer read the properties it knows and ignored any other, so verify_account_proof accepted such an answer. Both readers now check their keys first with onlyKeys, as the readers of block and account overrides do. onlyKeys moves next to fields in Serialization/JsonRpc.lean, with the lemmas onlyKeys_mkObj and onlyKeys_rejects. The round trip of the reader still holds, and accountProofOfJson_unknown_key and storageProofOfJson_unknown_key state the rejection. BREAKING CHANGE: execution.trie.verify_account_proof raises TrieError for an answer or a slot with a key outside its schema. In Lean, onlyKeys is EthLib.Serialization.JsonRpc.onlyKeys, where it was EthLib.Execution.Rpc.onlyKeys.
tcoratger
added a commit
that referenced
this pull request
Dec 4, 2026
…5458) The reader of an `eth_getProof` answer rejects an answer or a slot that holds a key outside its `AccountProof` or `StorageProof` schema, which set `additionalProperties: false`, where it ignored the key. `onlyKeys` moves to `Serialization/JsonRpc.lean`, and it and `hasOnly` share one search, `outsideField`. `accountProofOfJson_unknown_key` and `storageProofOfJson_unknown_key` state the rejection. Supersedes #5449. BREAKING CHANGE: `execution.trie.verify_account_proof` raises `TrieError` for an answer or a slot with a key outside its schema. In Lean, `onlyKeys` is `EthLib.Serialization.JsonRpc.onlyKeys`, where it was `EthLib.Execution.Rpc.onlyKeys`. Co-authored-by: ilitteri <ivanlitteri@hotmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The reader of an
eth_getProofanswer rejects an answer or a slot that holds a key outside its schema, where it ignored the key.The problem
The
AccountProofandStorageProofschemas of execution-apis setadditionalProperties: false.So an answer holds only its seven properties, and a slot only
key,valueandproof.accountProofOfJsonandstorageProofOfJson(Execution/Rpc/Proof.lean) read the properties that they know and ignored any other.So
execution.trie.verify_account_proofaccepted an answer that the schema does not allow.The readers of block and account overrides of
eth_simulateV1already follow the same rule of their schemas, withonlyKeys.The idea
Each reader first checks its keys with
onlyKeys, againstaccountProofKeysorstorageProofKeys, the properties of its schema.onlyKeysreads the raw object, so a key of valuenullcounts too, as it does for the overrides.onlyKeysmoves fromExecution/Rpc/Simulate.leantoSerialization/JsonRpc.lean, next tofields, so that both callers reach it.Its private lemma
onlyKeys_rejectsmoves with it and becomes public.onlyKeys_mkObjstates that an object built from pairs with distinct names, each among the keys, passes.With it,
accountProofOfJson_accountProofJson, the round trip of the reader, keeps its statement.accountProofOfJson_unknown_keyandstorageProofOfJson_unknown_keystate the rejection.Example
Take the answer of the fixture
get-account-proof-with-storage.ioat block 60, and add one property:Without the extra key, the answer shows one slot that is set,
[True], and it still does.Each rejection is
TrieErrorcode 0, the code of every reading error of this export.test_field_out_of_its_patternruns the three cases.For reviewers
nullthat the schema names, such as"address": null, passes the key check and then fails as a missing field, as before.The writer and the node's own answer were already within the schema.
onlyKeystoEthLib.Serialization.JsonRpc.onlyKeys.No module of
tests/downstreamor the bindings names it.Execution/Proofs/Rpc/Simulate.leangains a private import ofSerialization/Proofs/JsonRpc.lean, foronlyKeys_rejects.Checks
lake build --wfail(whole library, proofs and exports), onb91aea7: passed.lake exe gen-bindings --check: passed.lake exe check-decls: 0 findings.lake exe check-accessors,lake exe check-theoremsandcheck_theorems_baseline.py --base upstream/master: passed, nothing new.lake exe proof-coverage --checkandlake exe rule-history --check: passed.soundness_facts.py --check,check_layers.py,check_lean_layout.py --base upstream/master,check_comment_code.py,check_lean_commands.py,check_fork_cap.pyandcheck_fixture_pins.py: passed.uv run --no-sync pytest -n auto: 78558 passed, 680 skipped, 13 xfailed.check_vectors.py: 2328 pinned vectors match.ruff check,ruff format --check,ty check,check_raises.py,check_docstrings.py,check_python_boundary.pyandcheck_python_comments.py --all: passed.codespellran on the changed test file only.ty check --python-version 3.10of the package and the unit tests ofscripts/, which this change does not touch, and the build oftests/downstream.check_writing.py --base upstream/master: S1 and D1 suggestions only, the D1 ones on headers this change does not touch.BREAKING CHANGE:
execution.trie.verify_account_proofraisesTrieErrorfor an answer or a slot with a key outside its schema.In Lean,
onlyKeysisEthLib.Serialization.JsonRpc.onlyKeys, where it wasEthLib.Execution.Rpc.onlyKeys.